package model

import (
	"gorm.io/gorm"
	"time"
)

type Reservation struct {
	Id              uint           `gorm:"column:id;type:bigint(20) UNSIGNED;primaryKey;not null;" json:"id"`
	UserId          uint           `gorm:"column:user_id;type:bigint(20);comment:预约用户;not null;" json:"user_id"`                    // 预约用户
	HouseId         uint           `gorm:"column:house_id;type:bigint(20);comment:房源id;not null;" json:"house_id"`                  // 房源id
	ReservationTime time.Time      `gorm:"column:reservation_time;type:datetime(3);comment:预约时间;not null;" json:"reservation_time"` // 预约时间
	CreatedAt       time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt       time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (re *Reservation) TableName() string {
	return "reservation"
}
